<#include "/common/h-ui-base-css.html">
<#include "/common/h-ui-base-js.html">
<#include "/common/validation-js.html">

<link rel="stylesheet" type="text/css" href="/city-picker/css/cityPicker.css">

<script type="text/javascript" src="/city-picker/js/btnData.js"></script>
<script type="text/javascript" src="/city-picker/js/cityPicker.js"></script>

<body>
<article class="page-container">
	<form class="form form-horizontal" id="form-btn-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2" style="text-align: center"><span class="c-red">*</span>中文描述：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="text" class="input-text" value="${button.buttonName!}" placeholder="" id="btn_name" name="btn_name">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2" style="text-align: center"><span class="c-red">*</span>按钮名称：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="text" class="input-text" value="${button.buttonId!}" placeholder="" id="btn_id" name="btn_id">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2" style="text-align: center" ><span class="c-red">*</span>按钮说明：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="text" class="input-text" autocomplete="off" value="${button.buttonRemark!}" placeholder="" id="btn_remark" name="btn_remark">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2" style="text-align: center" ><span class="c-red">*</span>按钮图标：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="text" class="input-text" autocomplete="off" value="${button.iconCls!}" placeholder="" id="btn_icon" name="btn_icon">
			</div>
		</div>
	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
			<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
		</div>
	</div>
	</form>
</article>
<!--请在下方写此页面业务相关的脚本-->

<script type="text/javascript">
    var cityPicker = new IIInsomniaCityPicker({
        data: cityData,
        target: '#btn_icon',
        valType: 'k-v'
    });
    cityPicker.init();
</script>

<script type="text/javascript">
	$(function(){
        var id = ${button.id!-1};
        var menuId = ${menuId!-1};

		$('.skin-minimal input').iCheck({
			checkboxClass: 'icheckbox-blue',
			radioClass: 'iradio-blue',
			increaseArea: '20%'
		});
	$("#form-btn-add").validate({
		rules:{
            btn_name:{
				required:true,
				minlength:2,
				maxlength:16
			},
            btn_remark:{
				required:true,
                minlength:2,
			},
            btn_icon:{
				required:true,
                minlength:2,
			}
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
		    var parentId = 1;
			$(form).ajaxSubmit({
				type: 'post',
				url: "/btn-save/"+id +"/"+menuId,
				data :$("form-btn-add").serialize(),
				async:false,
				success: function(data){
                    parentId = data.parentId;
				},
                error: function(XmlHttpRequest, textStatus, errorThrown){
				}
			});
			var index = parent.layer.getFrameIndex(window.name);
            parent.$('#role_list_table').treegrid("reload",parentId);
			parent.layer.close(index);
		}
	});

});
</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
